STEP 8: We need an if statement INSIDE of our for loop to test if the user guessed the number correctly!

.say() will have purple and yellow indentation ········ because it's inside a loop and an if statement!

  • Go to and drag out If. Drop it inside of the for loop.
  • Change the test variable to guess and the test value to rand_num.
  • Drag out Say from and drop it inside of the if statement. Assign it to computer.


To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)